<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Block</title>
</head>

<body>
<?php
include("../connection/connection.php");
include("reportFunctions.php");
$distId=$_REQUEST['distId'];
$sqlReport = "SELECT type_scheme,sum(cwr_total) as CWR,sum(glsr_total) as GLSR,sum(glr_total) as GLR,sum(ohsr_total) as OHSR FROM `tbl_dtls_q1_main` where `district_id` = ".$distId." group by `type_scheme`";
//echo $sqlReport;
$queryReport = mysql_query($sqlReport);

?>
<table border="0" width="809" cellspacing="0" cellpadding="0">
	<tr>
		<td bgcolor="#E9E9E9" height="26">
		<p align="center"><span style="font-size: 9pt; font-weight: 700">
		<font face="Verdana" color="#224568">Scheme wise and Storage Structure 
		wise information on Reservoir capacity and their sufficiency (as per 
		PHED)</font></span></td>
	</tr>
	<tr>
	  <td bgcolor="#E9E9E9" height="26"><div align="center"><font face="Verdana" style="font-size: 9pt; font-weight: 700" color="#224568">Table 4 </font></div></td>
  </tr>
	<tr>
		<td bgcolor="#E9E9E9" height="56">
		<table border="1" width="809" cellspacing="0" cellpadding="0" height="47" bgcolor="#C5D8EB">
			<tr>
				
				<td width="123" align="center">
				<p align="center"><font face="Verdana" style="font-size: 8.5pt">
				Type of Scheme</font></td>
				<td width="109" align="center">
				<font style="font-size: 8.5pt" face="Verdana">Type of Reservoir</font></td>
				<td width="99" align="center">
				<font style="font-size: 8.5pt" face="Verdana">Number of 
				Reservoirs</font></td>
				<td width="113" align="center">
				<font face="Verdana" style="font-size: 8.5pt">Installed Capacity 
				(KL)</font></td>
				<td width="116" align="center">
				<font face="Verdana" style="font-size: 8.5pt">Current Population 
				Served 2010</font></td>
				<td align="center" width="117">
				<font style="font-size: 8.5pt" face="Verdana">Required Storage 
				capacity (KL)</font></td>
				<td width="116" align="center">
				<font style="font-size: 8.5pt" face="Verdana">Sufficiency of 
				installed storage capacity (%)</font></td>
			</tr>
		</table>		</td>
	</tr>
	<tr>
		<td>
		<table border="1" width="809" cellspacing="0" cellpadding="0" height="49" bordercolor="#C5D8EB" style="border: 1px solid #BBD1E8" bgcolor="#F9F9F9">
		<?php
			while($rowReport = mysql_fetch_array($queryReport)) {
			$storageCWR=0;
			$storageGLR=0;
			$storageGLST=0;
			$storageOHSR=0;
		?>
			<tr>
				<td align="left" width="124" rowspan="5" valign="top"><font face="Verdana" style="font-size: 8.5pt"><?php echo $rowReport['type_scheme']; ?></font></td>
				<td align="center" width="105"><font face="Verdana" style="font-size: 8.5pt">CWR</font></td>
				<td align="center" width="103"><font face="Verdana" style="font-size: 8.5pt"><?php echo $rowReport['CWR'];?></font></td>
				<td align="center" width="112"><font face="Verdana" style="font-size: 8.5pt"><?php echo getStorageSchemeWise($distId,$rowReport['type_scheme'],'CWR'); ?></font></td>
				<td align="center" width="116"><font face="Verdana" style="font-size: 8.5pt"><?php echo getPopulationStorageWise($distId,$rowReport['type_scheme'],'CWR'); ?></font></td>
				<td width="117" align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo $storageCWR=getPopulationStorageWise($distId,$rowReport['type_scheme'],'CWR')*40/1000; ?></font></td>
				<td align="center" width="116"><font face="Verdana" style="font-size: 8.5pt"><?php if($storageCWR==0 || $storageCWR==""){echo "0"; } else { echo number_format((getStorageSchemeWise($distId,$rowReport['type_scheme'],'CWR')*100)/$storageCWR,3); }?></font></td>
			</tr>
			<tr>
				<td align="center" width="105"><font face="Verdana" style="font-size: 8.5pt">GLR</font></td>
				<td align="center" width="103"><font face="Verdana" style="font-size: 8.5pt"><?php echo $rowReport['GLR'];?></font></td>
				<td align="center" width="112"><font face="Verdana" style="font-size: 8.5pt"><?php echo getStorageSchemeWise($distId,$rowReport['type_scheme'],'GLR'); ?></font></td>
				<td align="center" width="116"><font face="Verdana" style="font-size: 8.5pt"><?php echo getPopulationStorageWise($distId,$rowReport['type_scheme'],'GLR'); ?></font></td>
				<td align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo $storageGLR=getPopulationStorageWise($distId,$rowReport['type_scheme'],'GLR')*40/1000; ?></font></td>
				<td align="center" width="116"><font face="Verdana" style="font-size: 8.5pt"><?php echo number_format((getStorageSchemeWise($distId,$rowReport['type_scheme'],'GLR')*100)/$storageGLR,3); ?></font></td>
			</tr>
			<tr>
				<td align="center" width="105"><font face="Verdana" style="font-size: 8.5pt">GLSR</font></td>
				<td align="center" width="103"><font face="Verdana" style="font-size: 8.5pt"><?php echo $rowReport['GLSR'];?></font></td>
				<td align="center" width="112"><font face="Verdana" style="font-size: 8.5pt"><?php echo getStorageSchemeWise($distId,$rowReport['type_scheme'],'GLSR'); ?></font></td>
				<td align="center" width="116"><font face="Verdana" style="font-size: 8.5pt"><?php echo getPopulationStorageWise($distId,$rowReport['type_scheme'],'GLSR'); ?></font></td>
				<td align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo $storageGLSR=getPopulationStorageWise($distId,$rowReport['type_scheme'],'GLSR')*40/1000; ?></font></td>
				<td align="center" width="116"><font face="Verdana" style="font-size: 8.5pt"><?php if($storageGLSR==0 || $storageGLSR==""){echo "0"; } else { echo number_format((getStorageSchemeWise($distId,$rowReport['type_scheme'],'GLSR')*100)/$storageGLSR,3); }?></font></td>
			</tr>
			<tr>
				<td align="center" width="105"><font face="Verdana" style="font-size: 8.5pt">OHSR</font></td>
				<td align="center" width="103"><font face="Verdana" style="font-size: 8.5pt"><?php echo $rowReport['OHSR'];?></font></td>
				<td align="center" width="112"><font face="Verdana" style="font-size: 8.5pt"><?php echo getStorageSchemeWise($distId,$rowReport['type_scheme'],'OHSR'); ?></font></td>
				<td align="center" width="116"><font face="Verdana" style="font-size: 8.5pt"><?php echo getPopulationStorageWise($distId,$rowReport['type_scheme'],'OHSR'); ?></font></td>
				<td align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo $storageOHSR=getPopulationStorageWise($distId,$rowReport['type_scheme'],'OHSR')*40/1000; ?></font></td>
				<td align="center" width="116"><font face="Verdana" style="font-size: 8.5pt"><?php echo number_format((getStorageSchemeWise($distId,$rowReport['type_scheme'],'OHSR')*100)/$storageOHSR,3); ?></font></td>
			</tr>
			<tr>
				<td align="center" width="105"><font face="Verdana" style="font-size: 8.5pt">Blank</font></td>
				<td align="center" width="103"><font face="Verdana" style="font-size: 8.5pt">0</font></td>
				<td align="center" width="112"><font face="Verdana" style="font-size: 8.5pt">0</font></td>
				<td align="center" width="116"><font face="Verdana" style="font-size: 8.5pt"><?php echo getPopulationStorageWise($distId,$rowReport['type_scheme'],'blank'); ?></font></td>
				<td align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo $storageBlank=getPopulationStorageWise($distId,$rowReport['type_scheme'],'blank')*40/1000; ?></font></td>
				<td align="center" width="116"><font face="Verdana" style="font-size: 8.5pt"><?php echo 0*100/$storageBlank; ?></font></td>
			</tr>
			<tr>
				<td colspan="2" bgcolor="#E9E9E9" align="left" width="124"><font face="Verdana" style="font-size: 8.5pt">Total</font></td>
				
				<td align="center" bgcolor="#E9E9E9" width="103"><font face="Verdana" style="font-size: 8.5pt"><?php echo $rowReport['CWR']+$rowReport['GLR']+$rowReport['GLSR']+$rowReport['OHSR']+0;?></font></td>
				<td align="center" bgcolor="#E9E9E9" width="112"><font face="Verdana" style="font-size: 8.5pt"><?php echo $instaltot=getStorageSchemeWise($distId,$rowReport['type_scheme'],'CWR')+getStorageSchemeWise($distId,$rowReport['type_scheme'],'GLR')+getStorageSchemeWise($distId,$rowReport['type_scheme'],'GLSR')+getStorageSchemeWise($distId,$rowReport['type_scheme'],'OHSR'); ?></font></td>
				<td align="center" bgcolor="#E9E9E9" width="116"><font face="Verdana" style="font-size: 8.5pt"><?php echo getPopulationStorageWise($distId,$rowReport['type_scheme'],'CWR')+getPopulationStorageWise($distId,$rowReport['type_scheme'],'GLR')+getPopulationStorageWise($distId,$rowReport['type_scheme'],'GLSR')+getPopulationStorageWise($distId,$rowReport['type_scheme'],'OHSR')+getPopulationStorageWise($distId,$rowReport['type_scheme'],'blank'); ?></font></td>
				<td align="center" bgcolor="#E9E9E9"><font face="Verdana" style="font-size: 8.5pt"><?php echo $storagecap=$storageCWR+$storageGLR+$storageGLSR+$storageOHSR+$storageBlank;?></font></td>
				<td align="center" width="116" bgcolor="#E9E9E9"><font face="Verdana" style="font-size: 8.5pt"><?php echo number_format(($instaltot*100)/$storagecap,3); ?></font></td>
			</tr>
			<?php 
			//$slNo++;
			} ?>
		</table>		</td>
	</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>



</body>

</html>